import pandas as pd

# read in data
meta = pd.read_csv('../../data/metadata/stool/stool_metadata.csv', index_col=0)
# titer_data_2 = pd.read_csv('../../data/vaccine_response/vaccine_outcome_variable_y2.tsv', sep='\t', index_col=0)
titer_data_2 = pd.read_csv('../../data/vaccine_response/vaccine_response_y2.tsv', sep='\t', index_col=0) # check that this is right with KB
titer_data_2.index = [int(i.split('Baby')[-1]) for i in titer_data_2.index]

# get per sample titer data
stool_titer_data_2 = pd.DataFrame({sample: titer_data_2.loc[row['BabyN']] for sample, row in meta.iterrows() if row['BabyN'] in titer_data_2.index}).transpose()
stool_titer_data_2.to_csv('../../data/metadata/stool/stool_titers_yr2.csv', index_label='SampleID')
